@import "./icon/iconfont.css";

$green: #86bfa0;
$dark-green: #217346;
$light-green: #e7f7f6;
$bg-gray: #f5f5f5;
$active-border-gray: #bfbfbf;
$border-gray: #dfdfdf;
$active-gray: #dad8d6;
$text-gray: #5e5e5e;
$light-gray: #ededed;
$border: 1px solid $border-gray;
$active-border: 1px solid $active-border-gray;

.excel {
  width: 100%;
  height: 100%;
  overflow: hidden;
  * {
    box-sizing: border-box;
  }
  .header {
    width: 100%;
    height: 110px;
    background: $bg-gray;
    display: flex;
    flex-direction: column;
    padding-top: 10px;
    text-align: center;
    position: relative;
    button {
      margin: 0;
      background: #fff;
      margin-right: 15px;
      border: 1px solid #000;
      cursor: pointer;
      &:hover {
        background: $light-green;
      }
    }
    .header-item {
      display: flex;
      align-items: center;
      padding: 0 35px;
      .iconfont {
        cursor: pointer;
        font-size: 30px;
      }
      &.is-disabled > .iconfont {
        cursor: not-allowed;
        opacity: 0.4;
      }
      &:not(.is-disabled) > .iconfont:hover {
        background: $active-gray;
      }
      h2 {
        font-size: 16px;
        margin-right: 10px;
      }
      .down {
        transform: rotateX(180deg);
      }
    }
    .icon-merge {
      margin-left: 20px;
    }
  }
  .typed-area {
    display: flex;
    padding: 0 20px 10px 35px;
    background: $bg-gray;
    input {
      outline: none;
      border: $active-border;
      height: 25px;
      &:focus,
      &:hover {
        border: 1px solid $green;
      }
    }
    .cell-position {
      width: 120px;
      margin-right: 10px;
    }
    .cell-text {
      width: 100%;
    }
  }
  .content {
    width: 100%;
    height: calc(100% - 150px);
    display: grid;
    grid-template-rows: 25px auto;
    grid-template-columns: 35px auto;
    .corner {
      background: $bg-gray;
      border-right: $border;
      border-bottom: $border;
    }
    .cr {
      position: relative;
      background: $bg-gray;
      color: $text-gray;
      border-right: $border;
      border-bottom: $border;
      text-align: center;
      user-select: none;
      cursor: cell;
      &.active {
        background: $active-gray;
        color: $dark-green;
        border-right: $active-border;
        border-bottom: $active-border;
      }
    }
    .row-container {
      position: relative;
      overflow: hidden;
      height: 100%;
      width: 100%;
      .row-wrapper {
        height: 100%;
        position: absolute;
        width: max-content;
      }
      .row-item {
        height: 100%;
        display: inline-block;
        line-height: 25px;
        .row-resize {
          cursor: col-resize;
          height: 100%;
          width: 14px;
          position: absolute;
          right: -7px;
          top: 0;
          z-index: 1;
        }
      }
    }
    .col-container {
      position: relative;
      overflow: hidden;
      width: 100%;
      height: 100%;
      .col-wrapper {
        width: 100%;
        position: absolute;
        top: 0;
      }
      .col-item {
        width: 100%;
        .col-resize {
          cursor: row-resize;
          height: 6px;
          width: 100%;
          position: absolute;
          left: 0;
          bottom: -3px;
          z-index: 1;
        }
      }
    }
    .cell-container {
      position: relative;
      overflow: scroll;
      height: 100%;
      width: 100%;
      .cell-wrapper {
        position: absolute;
        top: 0;
        left: 0;
        display: grid;
        .cell-item {
          display: flex;
          border-right: $border;
          border-bottom: $border;
          cursor: cell;
          align-items: center;
          background: #fff;
          color: #000;
          font-size: 16px;
          .text {
            padding: 1px;
            word-break: break-word;
            word-wrap: break-word;
            white-space: pre-wrap;
            max-width: 100%;
            max-height: 100%;
          }
          textarea {
            resize: none;
            border: none;
            outline: none;
            font-size: 16px;
            width: 100%;
            height: 100%;
            overflow: hidden;
            font-family: "PingFang SC", "Source Sans Pro", "Helvetica Neue",
              "Microsoft Yahei", Helvetica, Arial, "Hiragino Sans GB",
              "Heiti SC", "WenQuanYi Micro Hei", sans-serif;
          }
        }
      }
      .select-line {
        position: absolute;
        background: $dark-green;
        cursor: cell;
        &.select-top {
          height: 2px;
        }
        &.select-left {
          width: 2px;
        }
        &.select-right {
          width: 2px;
        }
        &.select-bottom {
          height: 2px;
        }
      }
    }
  }
}
